load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_filegroup")

package(
    default_applicable_licenses = ["//:license"],
)

licenses(["notice"])

skia_filegroup(
    name = "rasterpipeline_hdrs",
    srcs = [
        "SkSLRasterPipelineBuilder.h",
        "SkSLRasterPipelineCodeGenerator.h",
    ],
    visibility = ["//src/core:__pkg__"],
)

skia_filegroup(
    name = "rasterpipeline_srcs",
    srcs = [
        "SkSLRasterPipelineBuilder.cpp",
        "SkSLRasterPipelineCodeGenerator.cpp",
    ],
    visibility = ["//src/core:__pkg__"],
)

skia_filegroup(
    name = "codegen_shared_priv",
    srcs = [
        "SkSLCodeGenerator.h",
    ],
)

skia_filegroup(
    name = "codegen_shared_exported",
    srcs = [
        "SkSLCodeGenTypes.h",
    ],
)

skia_cc_library(
    name = "gpu",
    srcs = [
        "SkSLPipelineStageCodeGenerator.cpp",
    ],
    hdrs = [
        "SkSLPipelineStageCodeGenerator.h",
    ],
    features = ["layering_check"],
    visibility = [
        "//src/gpu/ganesh:__pkg__",
        "//src/gpu/graphite:__pkg__",
        "//tools/skslc:__pkg__",
    ],
    deps = [
        "//:core",
        "//src/base",
        "//src/core:core_priv",
        "//src/gpu",
    ],
)

skia_cc_library(
    name = "glsl",
    srcs = [
        "SkSLGLSLCodeGenerator.cpp",
        ":codegen_shared_priv",
    ],
    hdrs = [
        "SkSLGLSLCodeGenerator.h",
        ":codegen_shared_exported",
    ],
    features = ["layering_check"],
    visibility = [
        "//src/gpu/ganesh/gl:__pkg__",
        "//tools/skslc:__pkg__",
    ],
    deps = [
        "//:core",
        "//src/base",
        "//src/core:core_priv",
    ],
)

skia_cc_library(
    name = "hlsl",
    srcs = [
        "SkSLHLSLCodeGenerator.cpp",
        "SkSLSPIRVtoHLSL.cpp",
        "SkSLSPIRVtoHLSL.h",
        ":codegen_shared_priv",
    ],
    hdrs = [
        "SkSLHLSLCodeGenerator.h",
        ":codegen_shared_exported",
    ],
    features = ["layering_check"],
    visibility = [
        "//tools/skslc:__pkg__",
    ],
    deps = [
        ":spirv",
        "//:core",
        "//src/base",
        "//src/core:core_priv",
        "@spirv_cross",
    ],
)

skia_cc_library(
    name = "metal",
    srcs = [
        "SkSLMetalCodeGenerator.cpp",
        ":codegen_shared_priv",
    ],
    hdrs = [
        "SkSLMetalCodeGenerator.h",
        ":codegen_shared_exported",
    ],
    features = ["layering_check"],
    visibility = [
        "//src/gpu/ganesh/mtl:__pkg__",
        "//src/gpu/mtl:__pkg__",
        "//tools/skslc:__pkg__",
    ],
    deps = [
        "//:core",
        "//src/base",
        "//src/core:core_priv",
    ],
)

skia_cc_library(
    name = "spirv",
    srcs = [
        "SkSLSPIRVCodeGenerator.cpp",
        ":codegen_shared_priv",
        "//src/sksl:gpu_hdrs",
    ],
    hdrs = [
        "SkSLSPIRVCodeGenerator.h",
        ":codegen_shared_exported",
    ],
    features = ["layering_check"],
    visibility = [
        "//src/gpu/vk:__pkg__",
        "//tools/skslc:__pkg__",
    ],
    deps = [
        "//:core",
        "//src/base",
        "//src/core:core_priv",
    ],
)

skia_cc_library(
    name = "spirv_validator",
    srcs = [
        "SkSLSPIRVValidator.cpp",
    ],
    hdrs = [
        "SkSLSPIRVValidator.h",
    ],
    features = ["layering_check"],
    visibility = [
        "//tools/skslc:__pkg__",
    ],
    deps = [
        "//:core",
        "//src/core:core_priv",
        "@spirv_tools",
    ],
)

skia_cc_library(
    name = "wgsl",
    srcs = [
        "SkSLWGSLCodeGenerator.cpp",
        ":codegen_shared_priv",
    ],
    hdrs = [
        "SkSLWGSLCodeGenerator.h",
        ":codegen_shared_exported",
    ],
    features = ["layering_check"],
    visibility = [
        "//tools/skslc:__pkg__",
    ],
    deps = [
        "//:core",
        "//src/base",
        "//src/core:core_priv",
    ],
)

skia_cc_library(
    name = "wgsl_validator",
    srcs = [
        "SkSLWGSLValidator.cpp",
    ],
    hdrs = [
        "SkSLWGSLValidator.h",
    ],
    features = ["layering_check"],
    visibility = [
        "//tools/skslc:__pkg__",
    ],
    deps = [
        "//:core",
        "//src/core:core_priv",
        "@dawn//:tint",
        "@dawn//src/tint/lang/wgsl",
        "@dawn//src/tint/lang/wgsl/reader",
    ],
)
